package com.bocomm.tracevisualization.api.result;

import lombok.Getter;
import lombok.ToString;

/**
 * comment:
 *
 */
@Getter
@ToString
public class CodeMessage {

    public static CodeMessage SUCCESS = new CodeMessage(200, "sucess");

    public static CodeMessage SERVER_ERROR = new CodeMessage(500100, "服务端异常%s");
    public static CodeMessage PARAMS_EMPTY_ERROR = new CodeMessage(500101, "参数为空异常：%s");
    public static CodeMessage FEIGN_INVOKE_ERROR = new CodeMessage(500102,"远程调用失败：%s");
    public static CodeMessage VALIDATE_ERROR = new CodeMessage(500103,"参数错误：%s");
    public static CodeMessage REPEAT_REQUEST= new CodeMessage(500104,"重复请求:%s");
    public static CodeMessage QUEUE_UP_REQUEST= new CodeMessage(500105,"排队等待中");
    public static CodeMessage RUNTIME_ERROR = new CodeMessage(500106, "请求异常:%s");
    public static CodeMessage ILLEGAL_TOKEN_ERROR = new CodeMessage(500201, "TOKEN状态异常：[%s]");
    public static CodeMessage HAS_NO_TOKEN_ERROR = new CodeMessage(500202, "用户尚未登录：%s");
    public static CodeMessage LOGIN_TOKEN_EXPIRED = new CodeMessage(500203,"Token已过期");
    public static CodeMessage LOGIN_TOKEN_INCORRECT = new CodeMessage(500204,"无效Token");
    public static CodeMessage LOGIN_USER_NOT_EXIST = new CodeMessage(500205,"用户不存在");
    public static CodeMessage LOGIN_PASSWORD_INCORRECT = new CodeMessage(500206,"用户名或密码错误");
    public static CodeMessage ILLEGAL_STATUS_ERROR = new CodeMessage(500208,"用户状态异常：%s");
    public static CodeMessage THIRD_PARTY_AUTH_ERROR= new CodeMessage(500210, "第三方授权失败:%s");
    public static CodeMessage REGISTER_USER_HAS_EXIST = new CodeMessage(500211, "用户已注册,请勿重复注册!");
    public static CodeMessage CORS_SAVE_FAIL = new CodeMessage(500500, "新增学科失败");
	public static CodeMessage ORDER_NOT_EXIST = new CodeMessage(500301,"查询订单不存在:%s");
	public static CodeMessage ORDER_FAILED = new CodeMessage(500302,"订单操作失败:%s");
    public static CodeMessage ORDER_NOT_ERROR = new CodeMessage(500303, "订单参数错误%s");
    public static CodeMessage ORDER_NOT_REPEAT = new CodeMessage(500304, "请不要重复提交订单，%s");
    public static CodeMessage ORDER_NOT_TIMEOUT = new CodeMessage(500305, "订单超时, %s");
	public static CodeMessage PARAMETER_EMPTY = new CodeMessage(500601, "参数为空%s");
	public static CodeMessage PARAMETER_ERROR = new CodeMessage(500602, "参数错误%s");
	public static CodeMessage VALIDITY_FAILED = new CodeMessage(500604, "参数校验失败%s");


    private int code;
    private String message;

    private CodeMessage(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public CodeMessage fillArgs(Object... args) {
        this.message = String.format(this.message, args);
        return this;
    }
}
